package com.chen.mapper;

import com.chen.pojo.ClassQueryParam;
import com.chen.pojo.ClassRoom;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClassMapper {

    List<ClassRoom> list(ClassQueryParam classQueryParam);

    @Delete("delete from classroom where id=#{id}")
    void delete(Integer id);

    @Insert("insert into classroom(id,name, room, begin_date, end_date, master_id, subject, create_time, update_time) values(null,#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void add(ClassRoom classRoom);

    @Select("select id,name,room,begin_date,end_date,master_id,subject,create_time,update_time from classroom where id=#{id}")
    ClassRoom getInfoById(Integer id);

    void update(ClassRoom classRoom);

    @Select("select * from classroom")
    List<ClassRoom> findAll();

}
